package com.lemon.tieba.post.domain;

import com.github.pagehelper.PageInfo;
import lombok.Data;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 帖子
 *
 * @author ymh
 * @date 2019-3-29 16:12
 */
@Data
@Table(name = "func_post")
public class Post {

    // 帖子
    public static final int TYPE_POST = 1;
    // 楼层
    public static final int TYPE_FLOOR = 2;
    // 回复
    public static final int TYPE_REPLY = 3;

    @Id
    @KeySql(useGeneratedKeys = true)
    private Long id;

    // 帖子标题
    private String title;

    // 内容
    private String content;

    // 纯文本
    private String text;

    // 图片地址
    @Column(name = "img_urls")
    private String imgURLs;

    // 类型 (1帖子 2楼层 3回复)
    private Integer type;

    // 用户id
    private Long userId;

    // 用户名
    private String username;

    // 用户头像地址
    private String avator;

    // 回复id
    private Long replyId;

    // 回复用户id
    private Long replyUserId;

    // 回复用户名称
    private String replyUsername;

    // 父id
    private Long parentId;

    // 楼层
    @Column(name = "`index`")
    private Integer index;

    // 子集
    @Transient
    private PageInfo<Post> children;

    // 创建时间
    private Long created;

    // 修改时间
    private Long updated;
}
